<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="keywords" content="jquery,ui,easy,easyui,web">
	<meta name="description" content="easyui help you build your web page easily!">
	<title>Dubbo Demo</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="css/bootstrap-table.css">
	<!-- <script type="text/javascript" src="js/jquery-2.1.1.js"></script> -->
	<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript" src="js/bootstrap-table.js"></script>
	<script type="text/javascript">
	function add()
    {
		$("#d1").css("display","block");
    }
	
	$(document).ready(function(){
		

		 
		$("#b1").click(function(){
		    
             var form = new FormData(document.getElementById("demo"));
             var user = {
            	      name:$("#name").val(),
            	      age:$("#age").val(),
            	      sex:$("#sex").val()
            	    };
            $.ajax({
            	   url: "api/user/insert",
            	   data:user,
                   type: "POST",
                   success: function(msg){
                	   if(msg.success)
               		   {
                		   alert( "保存成功 " );
               		   }
                	   else
                	   {
                		   alert( "保存失败 " );
                	   }
                    
                   }
                });
        });
        
        
		});
		</script>

</head>
<body>
	<table data-toggle="table" data-url="api/user/list" data-height="246" data-pagination="true">
    <thead>
        <tr>
            <th data-field="state" data-checkbox="true"></th>
            <th data-field="id" data-align="right">id</th>
            <th data-field="name" data-align="right">Name</th>
            <th data-field="age" data-align="center">Age</th>
            <th data-field="sex" data-align="">Sex</th>
        </tr>
    </thead>
    
   
</table>
<button type="button" class="btn btn-primary" onclick="add()">增加</button>
<div id="d1" style="display:none;">
	<form id="demo" method="post">
		name:<br>
		<input type="text" name="name" id="name">
		<br>
		age:<br>
		<input type="text" name="age" id="age">
		<br>
		sex:<br>
		<input type="text" name="sex" id="sex">
		<br>
		<br>
		<br>
	<button type="button" id="b1">Click me</button>
	</form>
</div>

</body>
</html>